function g1 = dynamic_g1(T, y, x, params, steady_state, it_, T_flag)
% function g1 = dynamic_g1(T, y, x, params, steady_state, it_, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T             [#temp variables by 1]     double   vector of temporary terms to be filled by function
%   y             [#dynamic variables by 1]  double   vector of endogenous variables in the order stored
%                                                     in M_.lead_lag_incidence; see the Manual
%   x             [nperiods by M_.exo_nbr]   double   matrix of exogenous variables (in declaration order)
%                                                     for all simulation periods
%   steady_state  [M_.endo_nbr by 1]         double   vector of steady state values
%   params        [M_.param_nbr by 1]        double   vector of parameter values in declaration order
%   it_           scalar                     double   time period for exogenous variables for which
%                                                     to evaluate the model
%   T_flag        boolean                    boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   g1
%

if T_flag
    T = model_5_IRFs.dynamic_g1_tt(T, y, x, params, steady_state, it_);
end
g1 = zeros(46, 61);
g1(1,40)=1;
g1(1,44)=(-T(46));
g1(2,21)=(-T(26));
g1(2,42)=1;
g1(2,44)=(-T(25));
g1(2,2)=(-T(27));
g1(3,21)=(-T(29));
g1(3,41)=1;
g1(3,44)=(-T(28));
g1(3,2)=(-T(30));
g1(4,21)=(-T(32));
g1(4,43)=1;
g1(4,44)=(-T(31));
g1(4,2)=(-T(33));
g1(5,52)=(-(T(4)*(y(55)*params(10)*(1-params(9))+y(56)*(1-params(8))*params(12)*params(9)*params(10)+y(57)*params(14)*params(9)*params(10))));
g1(5,53)=(-(params(1)/y(54)*(1-params(4))*T(5)));
g1(5,37)=(-1)/(y(37)*y(37));
g1(5,54)=(-(T(5)*y(53)*(1-params(4))*(-params(1))/(y(54)*y(54))+(-(params(1)*(1-params(8))))/(y(54)*y(54))));
g1(5,55)=(-(T(4)*y(52)*params(10)*(1-params(9))));
g1(5,56)=(-(T(4)*params(12)*params(9)*y(52)*params(10)*(1-params(8))));
g1(5,57)=(-(T(4)*params(14)*params(9)*y(52)*params(10)));
g1(6,33)=1;
g1(7,21)=(-(params(3)*1/y(51)/(1-params(3))*T(34)));
g1(7,37)=1;
g1(7,51)=(-(params(3)*T(34)*(-y(21))/(y(51)*y(51))/(1-params(3))));
g1(8,23)=getPowerDeriv(y(23),(-params(2)),1);
g1(8,37)=(-((-(params(6)/(1-params(5))))/(y(37)*y(37))));
g1(9,21)=(-(y(1)*T(35)));
g1(9,1)=(-T(19));
g1(9,37)=y(45)/params(6);
g1(9,45)=y(37)/params(6);
g1(9,2)=(-(y(1)*T(36)));
g1(10,14)=1;
g1(10,45)=(-(0.5*1/y(45)/params(21)/1.414213562373095*2/(exp(T(7)^2)*1.772453850905516)));
g1(11,26)=1;
g1(11,45)=(-T(47));
g1(12,27)=1;
g1(12,49)=(-1);
g1(13,38)=1;
g1(14,27)=(-(1+y(38)));
g1(14,38)=(-(1+y(27)));
g1(14,39)=1;
g1(15,21)=y(44)*(1-params(4));
g1(15,44)=y(21)*(1-params(4));
g1(15,2)=(-(1-params(8)));
g1(16,14)=(-(T(20)*y(1)*params(10)));
g1(16,21)=(-(y(1)*params(10)*y(14)*T(38)));
g1(16,1)=(-(params(10)*y(14)*T(20)));
g1(16,36)=1;
g1(16,44)=(-(y(1)*params(10)*y(14)*T(37)));
g1(16,2)=(-(y(1)*params(10)*y(14)*T(39)));
g1(17,14)=(-(T(9)*y(1)*params(10)));
g1(17,21)=(-(y(1)*params(10)*y(14)*T(41)));
g1(17,1)=(-(params(10)*y(14)*T(9)));
g1(17,35)=1;
g1(17,44)=(-(y(1)*params(10)*y(14)*T(40)));
g1(17,2)=(-(y(1)*params(10)*y(14)*T(42)));
g1(18,24)=y(28);
g1(18,28)=y(36)+y(35)+y(24);
g1(18,35)=y(28)-1;
g1(18,36)=y(28)-1;
g1(19,29)=y(36)+y(35);
g1(19,35)=y(29);
g1(19,36)=y(29)-1;
g1(20,14)=(-(y(40)*y(1)*params(10)+y(43)*y(1)*params(10)));
g1(20,22)=1;
g1(20,1)=(-(params(52)+y(40)*params(10)*y(14)+y(43)*params(10)*y(14)));
g1(20,40)=(-(y(1)*params(10)*y(14)));
g1(20,43)=(-(y(1)*params(10)*y(14)));
g1(21,23)=(-1);
g1(21,25)=1;
g1(21,1)=1-params(8);
g1(21,32)=(-1);
g1(21,50)=(-1);
g1(22,21)=(-(y(22)/(1-params(3))));
g1(22,22)=(-(y(21)/(1-params(3))));
g1(22,25)=1;
g1(23,24)=1;
g1(23,1)=1-params(8);
g1(23,32)=(-1);
g1(24,22)=(-T(11));
g1(24,34)=1;
g1(24,37)=(-(y(22)*y(51)*(-params(3))/(y(37)*y(37))*getPowerDeriv(params(3)/y(37),1/(1-params(3)),1)));
g1(24,51)=(-(y(22)*T(10)));
g1(25,25)=(-1);
g1(25,30)=T(15)*T(12)*T(14);
g1(25,1)=T(15)*T(13)*getPowerDeriv(y(1),1-params(3),1);
g1(25,34)=T(13)*T(14)*getPowerDeriv(y(34),params(3),1);
g1(25,51)=T(15)*T(14)*T(48);
g1(26,30)=(-T(12));
g1(26,31)=1;
g1(26,51)=(-T(48));
g1(27,21)=(-T(44));
g1(27,44)=(-T(43));
g1(27,46)=1;
g1(27,2)=(-T(45));
g1(28,14)=(-(params(10)*T(24)));
g1(28,21)=(-T(22));
g1(28,44)=(-T(21));
g1(28,47)=1;
g1(28,2)=(-T(23));
g1(29,17)=1;
g1(29,37)=(-(1/y(37)));
g1(30,13)=1;
g1(30,27)=(-(1/(1+y(27))));
g1(31,19)=1;
g1(31,39)=(-1);
g1(32,11)=1;
g1(32,28)=(-(1/y(28)));
g1(33,12)=1;
g1(33,29)=(-(1/y(29)));
g1(34,20)=1;
g1(34,30)=(-(1/y(30)));
g1(35,10)=1;
g1(35,31)=(-(1/y(31)));
g1(36,18)=1;
g1(37,6)=1;
g1(37,25)=(-(1/(y(25)+y(37)*y(26)*params(15)-y(50))));
g1(37,26)=(-(y(37)*params(15)/(y(25)+y(37)*y(26)*params(15)-y(50))));
g1(37,37)=(-(y(26)*params(15)/(y(25)+y(37)*y(26)*params(15)-y(50))));
g1(37,50)=(-((-1)/(y(25)+y(37)*y(26)*params(15)-y(50))));
g1(38,8)=1;
g1(38,24)=(-(1/y(24)));
g1(39,7)=1;
g1(39,23)=(-(1/(y(23)+y(37)*y(26)*params(15))));
g1(39,26)=(-(y(37)*params(15)/(y(23)+y(37)*y(26)*params(15))));
g1(39,37)=(-(y(26)*params(15)/(y(23)+y(37)*y(26)*params(15))));
g1(40,9)=1;
g1(40,26)=(-(1/(y(26)+y(34))));
g1(40,34)=(-(1/(y(26)+y(34))));
g1(41,16)=1;
g1(41,46)=(-(1/y(46)));
g1(42,15)=1;
g1(42,47)=(-(1/y(47)));
g1(43,2)=(-(params(22)*1/y(2)));
g1(43,48)=1/y(48);
g1(43,58)=(-params(26));
g1(44,3)=(-(params(24)*1/(1+y(3))));
g1(44,49)=1/(1+y(49));
g1(44,60)=params(28);
g1(45,5)=(-(params(23)*1/y(5)));
g1(45,51)=1/y(51);
g1(45,59)=(-params(27));
g1(46,4)=(-(params(25)*1/y(4)));
g1(46,50)=1/y(50);
g1(46,61)=(-params(29));

end
